/**
 * 更加细致的异常分类
 *
 * 空指针异常，undefined 和 null 都会导致这个异常
 */
export class NullPointerException extends Error {
    constructor(message) {
        super(message);
    }
}

/**
 * 类型转换异常
 */
export class ClassCastException extends Error {
    constructor(message) {
        super(message);
    }
}

/**
 * 非法输入参数异常
 */
export class IllegalArgumentException extends Error {
    constructor(message) {
        super(message);
    }
}

/**
 * 状态异常异常
 */
export class IllegalStateException extends Error {
    constructor(message) {
        super(message);
    }
}

/**
 * 方法未定义异常
 */
export class MethodUndefinedException extends Error {
    constructor(message) {
        super(message);
    }
}

// 绑定到 windows 对象，方便全局调用
window.ClassCastException = ClassCastException;
window.NullPointerException = NullPointerException;
window.IllegalStateException = IllegalStateException;
window.IllegalArgumentException = IllegalArgumentException;
window.MethodUndefinedException = MethodUndefinedException;